<template>
  <div class="tabBar">
    <!-- route 是否开启路由模式 -->
    <van-tabbar
      v-model="active"
      :route="true"
      @change="onChange"
      active-color="red"
    >
      <van-tabbar-item icon="home-o" to="/home">首页</van-tabbar-item>
      <van-tabbar-item icon="label-o" to="/topic">专题</van-tabbar-item>
      <van-tabbar-item icon="apps-o" to="/category">分类</van-tabbar-item>
      <van-tabbar-item icon="cart-o" to="/cart">购物车</van-tabbar-item>
      <van-tabbar-item icon="user-o" to="/mine">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: "VueTabbar",

  data() {
    return {
      active: 0,
    };
  },

  mounted() {},

  methods: {
    onChange(m) {
      this.active = m;
    },
  },
};
</script>

<style lang="less" scoped>
.tabBar {
  padding-bottom: 50px;
  width: 100%;
  img {
    width: 100px;
    display: block;
  }
}
</style>
